package poly;

public class Demo {
    public static void main(String[] args) {
        //多态出现
        Animal a = new Dog();
        a.eat();

        a = new Cat();
        a.eat();

        a = new Shark();
        a.eat();
    }
}
interface Animal{
    public abstract void eat();
}
class Shark implements Animal{
    @Override
    public void eat(){
        System.out.println("鲨鱼吃人");
    }

}
class Dog implements Animal{
    public void eat(){
        System.out.println("狗吃骨头");
    }
}
class Cat implements Animal{

    @Override
    public void eat() {
        System.out.println("猫吃罐头");

    }
}
